FROM latifrons/golang-alpine-builder:1.13 as builder

ENV GOPROXY https://goproxy.cn
ENV GO111MODULE on

WORKDIR /apps
COPY go.mod .
COPY go.sum .
RUN go mod download

COPY . .
RUN go build -o ./statistics .

FROM alpine:latest
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk add --no-cache curl iotop busybox-extras

COPY --from=builder /apps /apps

EXPOSE 8080 8081

WORKDIR /apps

CMD ["./statistics"]
